import { Goblet } from '@element-plus/icons-vue';
import GlobalConst from '../../common/globalConst.js'
var global = GlobalConst.GlobalConst;

import { LGXEnums } from '../../common/sysenum.js';


import utilfuncs from '../../common/tools/utilfuncs.js';
var funcs = utilfuncs.UtilFuncs;

var CGraphTypeUtil = {}


CGraphTypeUtil.getType32 = function (typeID, symbol) {
    var mainType = (typeID >> 16);
    let tGraphType = LGXEnums.LGXGraphType.AbstractGraph_type;
    if (symbol) {
        let moldActionType = symbol.getMoldActionType();
        if (moldActionType == LGXEnums.moldActionType.packege) {
            tGraphType = LGXEnums.LGXGraphType.umlpackage_type;
        }
        else if (moldActionType == LGXEnums.moldActionType.item) {
            tGraphType = LGXEnums.LGXGraphType.containerItem_type;
        }
        else if (moldActionType == LGXEnums.moldActionType.container) {
            tGraphType = LGXEnums.LGXGraphType.Container_type;
        }
        else {
            tGraphType = this.getType16(mainType, typeID);
        }
    }
    else {
        tGraphType = this.getType16(mainType, typeID);
    }
    return tGraphType;
}

CGraphTypeUtil.getType16 = function (nType, fulltoolKind) {
    var tGraphType = LGXEnums.LGXGraphType.AbstractGraph_type;
    if (funcs.isMoldGraph16(nType)) {
        tGraphType = LGXEnums.LGXGraphType.MoldGraph_type;
    }
    else if (nType == global.BaseUnitRectangle) {
        tGraphType = LGXEnums.LGXGraphType.RectGraph_type;
    }
    else if (nType == global.ConnectLine) {
        tGraphType = LGXEnums.LGXGraphType.LineGraph_type;
    }
    else if (nType == global.BaseUnitText || nType == global.BaseUnitYCText) {
        if (fulltoolKind == global.DimTextType) {
            tGraphType = LGXEnums.LGXGraphType.DimTextGraph_type;
        }
        else if (fulltoolKind == global.CADTextType) {
            tGraphType = LGXEnums.LGXGraphType.CADText_type;
        }
        else {
            tGraphType = LGXEnums.LGXGraphType.TextGraph_type;
        }
    }
    else if (nType == global.BaseUnitPolyline) {
        tGraphType = LGXEnums.LGXGraphType.LineGraph_type;
    }
    else if (nType == global.BaseUnitPolygon) {
        tGraphType = this.getSpecialPolygonTypeByFullKind(fulltoolKind);
    }
    else if (nType == global.BaseUnitImage) {
        tGraphType = LGXEnums.LGXGraphType.ImageGraph_type;
    }
    else if (nType == global.CompositSymGraphType) {
        tGraphType = LGXEnums.LGXGraphType.CompositGraph_type;
    }
    else if (nType == global.BaseUnitCircle) {
        tGraphType = LGXEnums.LGXGraphType.CircleGraph_type;
    }
    else if (nType == global.BaseUnitArc) {
        tGraphType = LGXEnums.LGXGraphType.ArcGraph_type;
    }
    else if (nType == global.CompositeFrameType) {
        tGraphType = LGXEnums.LGXGraphType.Combine_type;
    }
    else if (nType == global.CommBusLine) {
        tGraphType = LGXEnums.LGXGraphType.CommBusGraph_type;
    }
    else if (nType == global.Dynamic_PipeLineID) {
        tGraphType = LGXEnums.LGXGraphType.PipeLineGraph_Type;
    }
    else if (nType == global.Dynamic_TimerTypeID) {
        tGraphType = LGXEnums.LGXGraphType.TimerCtrl_type;
    }
    else if (nType == global.QuadraticCurve) {
        tGraphType = LGXEnums.LGXGraphType.QuadraticCurve_type;
    }
    else if (nType == global.BezierCurve) {
        tGraphType = LGXEnums.LGXGraphType.BezierCurve_type;
    }
    else if (nType == global.PathType) {
        tGraphType = LGXEnums.LGXGraphType.Path_type;
    }
    else if (nType == global.dimLine) {
        tGraphType = LGXEnums.LGXGraphType.dimLine_type;
    }
    else if (nType == global.dimRadius) {
        tGraphType = LGXEnums.LGXGraphType.dimRadius_type;
    }
    else if (nType == global.dimDiameter) {
        tGraphType = LGXEnums.LGXGraphType.dimDiameter_type;
    }
    else if (nType == global.dimAngle) {
        tGraphType = LGXEnums.LGXGraphType.dimAngle_type;
    }
    else if (nType == global.dimAlign) {
        tGraphType = LGXEnums.LGXGraphType.dimAlign_type;
    }
    else if (nType == global.dimArc) {
        tGraphType = LGXEnums.LGXGraphType.dimArc_type;
    }
    else if (nType == global.AuxLine) {
        tGraphType = LGXEnums.LGXGraphType.Auxline_type;
    }
    else if (nType == global.CylinderType) {
        tGraphType = LGXEnums.LGXGraphType.Cylinder_type;
    }
    else if (nType == global.CubeType) {
        tGraphType = LGXEnums.LGXGraphType.Cube_type;
    }
    else if (nType == global.SpecialRectType) {
        tGraphType = LGXEnums.LGXGraphType.SpecialRect_type;
    }
    else if (nType == global.XMindType) {
        tGraphType = LGXEnums.LGXGraphType.XMindTheme_type;
    }
    else if (nType == global.SpLine) {
        tGraphType = LGXEnums.LGXGraphType.SplineGraph_type;
    }
    else if (nType == global.BaseUnitEllipse) {
        tGraphType = LGXEnums.LGXGraphType.EllipseGraph_type;
    }
    else if (nType == global.BaseUnitEllipseArc) {
        tGraphType = LGXEnums.LGXGraphType.EllipseArcGraph_type;
    }
    else if (nType == global.Hatch) {
        tGraphType = LGXEnums.LGXGraphType.Hatch_type;
    }

    if (tGraphType == LGXEnums.LGXGraphType.AbstractGraph_type
        && ((nType >> 8) == 0x02)) {
        tGraphType = LGXEnums.LGXGraphType.MoldGraph_type;
    }

    return tGraphType;
}

CGraphTypeUtil.getSpecialPolygonTypeByFullKind = function (fulltoolKind) {
    let tGraphType = LGXEnums.LGXGraphType.AbstractGraph_type;
    let subKind = fulltoolKind & 0x0000ff00;
    subKind = subKind >> 8;
    if (subKind == 0x01) {
        tGraphType = LGXEnums.LGXGraphType.RegularPolygon_type;
    }
    else if (subKind == 0x02) {
        tGraphType = LGXEnums.LGXGraphType.MultiStar_type;
    }
    else {
        tGraphType = LGXEnums.LGXGraphType.PolygonGraph_type;
    }
    return tGraphType;
}

CGraphTypeUtil.isRealGraph = function (graphType) {
    let flag = true;
    switch (graphType) {
        case LGXEnums.LGXGraphType.MultiSel_Rect_Type:
        case LGXEnums.LGXGraphType.FastToolPanel_type:
        case LGXEnums.LGXGraphType.dimLine_type:// = "dim_line";//线性标注
        case LGXEnums.LGXGraphType.dimRadius_type:// = "dim_radius";//半径标注
        case LGXEnums.LGXGraphType.dimDiameter_type:// = "dim_diameter";//直径标注
        case LGXEnums.LGXGraphType.dimAngle_type:// = "dim_angle";//角度标注
        case LGXEnums.LGXGraphType.dimAlign_type:// = "dim_align";//对齐标注
        case LGXEnums.LGXGraphType.dimArc_type:// = "dim_arc";//圆弧标注
        case LGXEnums.LGXGraphType.DimTextGraph_type:// = "dim_arc";//圆弧标注
        case LGXEnums.LGXGraphType.CoordFrame_type:
        case LGXEnums.LGXGraphType.AbstractGraph_type:
            flag = false;
            break;

        default:
            break;
    }
    return flag;
}

export { CGraphTypeUtil }
